package com.cy.pojo;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by PVer on 2017/8/3.
 */
public class CacheList {
    private final Logger logger = LoggerFactory.getLogger(CacheList.class);
    /**
     * 缓存池长度
     */
    private static final int CACHESIZE = 20;
    /**
     * 缓存池
     */
    private List<Notice> cache = new ArrayList<>();


    /**
     * 新增成功返回true
     * @return
     */
    public synchronized boolean add(Notice notice){
        if (!cache.contains(notice)){
            cache.add(notice);
            return true;
        }
        return false;
    }





    public List<Notice> getCache() {
        return cache;
    }

    public void setCache(List<Notice> cache) {
        this.cache = cache;
    }
}
